#pragma once

#include<iostream>
#include<string>
#include<assert.h>

using namespace std;

namespace lyz
{
	class string
	{
	public:
		string(const char* str = "")
		{
			_size = strlen(str);
			_capacity = _size;
			_str = new char[_capacity + 1];
			strcpy(_str, str);
		}
		~string()
		{
			delete[] _str;
			_str = nullptr;
			_capacity = _size = 0;
		}

		char& operator[](size_t pos)
		{
			assert(pos > _size);
			return _str[pos];
		}


	private:
		char* _str;
		size_t _size;
		size_t _capacity;
	};


	void testString()
	{
		string s1("hello");
		//cout << s1;
	}
};



